package com.example.wlf.gamerecorder;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.example.wlf.gamerecorder.gameon.SimpleGameonActivity;
import com.example.wlf.gamerecorder.gameon.SettingActivity;

import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;

public class MainActivity extends AppCompatActivity {

    private static String TAG = "GameRecorder_Main";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        /*
        Log.d(TAG,"helloworldaaa");
        Toast.makeText(this,"GameRecorder",Toast.LENGTH_SHORT).show();
        registToWX();
        */
        Button button_wx = (Button)findViewById(R.id.button_wx);
        button_wx.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //wxLogin();
            }
        });

        /**
         * 进入比赛，调用全屏活动
         */
        Button button_simplegameon = (Button)findViewById(R.id.button_simplegameon);
        button_simplegameon.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){

                //Intent intent = new Intent(MainActivity.this,TestActivity.class);
                Intent intent = new Intent(MainActivity.this,SimpleGameonActivity.class);
                startActivity(intent);
            }
        });

    }
    private void registToWX() {
        //Constants.APP_ID是你应用在微信开放平台上的AppID。
        Constants.wx_api = WXAPIFactory.createWXAPI(this, Constants.APP_ID, false);
        // 将该app注册到微信
        Constants.wx_api.registerApp(Constants.APP_ID);
    }
    private void wxLogin() {
        if (!Constants.wx_api.isWXAppInstalled()) {
            Toast.makeText(this,"您还未安装微信客户端",Toast.LENGTH_SHORT).show();
            return;
        }
        final SendAuth.Req req = new SendAuth.Req();
        req.scope = "snsapi_userinfo";
        req.state = "diandi_wx_login";
        Constants.wx_api.sendReq(req);
    }


}
